package com.fenghongzhang.lib_jetpack.room.raw

import androidx.room.Database
import androidx.room.RoomDatabase
import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase

@Database(entities = [User::class], version = 2)
abstract class AppDatabase : RoomDatabase() {
    abstract fun userDao(): UserDao
    abstract fun userDao2(): UserDao


}
val MIGRATION_1_2 = object : Migration(1, 2) {
    override fun migrate(database: SupportSQLiteDatabase) {
        // 添加新表
        database.execSQL("CREATE TABLE IF NOT EXISTS addresses (id INTEGER PRIMARY KEY, street TEXT, city TEXT)")

        // 添加新列
        database.execSQL("ALTER TABLE users ADD COLUMN email TEXT")
    }
}